package com.mybatiscore.jiaocheng.d05mybatis_高级映射_加载延迟;

import com.mybatiscore.Mapper.ClaszMapper;
import com.mybatiscore.POJO.Clasz;
import com.mybatiscore.Util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

public class d02_一对多 {
    //1.collection标签
    @Test
    public void testCollection(){
        SqlSession sqlSession = SqlSessionUtil.openSession();
        ClaszMapper mapper = sqlSession.getMapper(ClaszMapper.class);
        Clasz clasz = mapper.selectByIdCollection(1001);
        System.out.println(clasz);
        sqlSession.close();
    }

    //2.分布——延迟加载
    @Test
    public void testFB(){
        SqlSession sqlSession = SqlSessionUtil.openSession();
        ClaszMapper mapper = sqlSession.getMapper(ClaszMapper.class);
        Clasz clasz = mapper.selectByIdFb(1001);
        System.out.println(clasz.toString());
        sqlSession.close();
    }
}
